<template>
	<view>
		<goods-list :goodsList="goodsList"></goods-list>
	</view>
</template>

<script>
	import goodsList from '@/components/goods-list/goods-list.vue'
	import {getGoodsListFromNews} from '../../api/index/index.js'
	export default {
		components:{
			goodsList,
		},
		data() {
			return {
				page:1,
				limit:10,
				goodsList:[]
			}
		},
		methods: {
			//点击news获取商品列表
			async getGoodsListFromNews(page,limit){
				const id=getCurrentPages()[1].options.id
				const {data:res}=await getGoodsListFromNews(id,page,limit)
				this.goodsList=res
				// console.log(this.goodsList)
			}
		},
		onLoad() {
			// console.log(getCurrentPages()[1].options.id)
			this.getGoodsListFromNews(this.page,this.limit)
		}
	}
</script>

<style>

</style>
